package org.hwadee.entity;

import org.springframework.stereotype.Component;

import javax.sound.midi.Receiver;
import java.util.Date;

@Component
public class Communication {

    private Integer communicationId;


    /**
     * 参与私信的用户1
     */
    private Integer sender;

    /**
     * 参与私信的用户2
     */
    private Integer receiver;

    /**
     * 是否有新消息
     */
    private boolean hasNewMessage;

    private Date lastMessageTime;

    //非数据库参数
    private User senderUser;
    private User receiverUser;

    public Communication() {

    }

    public Communication(Integer sender, Integer receiver, boolean hasNewMessage) {
        this.sender = sender;
        this.receiver = receiver;
        this.hasNewMessage = hasNewMessage;
    }

    public User getSenderUser() {
        return senderUser;
    }

    public void setSenderUser(User senderUser) {
        this.senderUser = senderUser;
    }

    public User getReceiverUser() {
        return receiverUser;
    }

    public void setReceiverUser(User receiverUser) {
        this.receiverUser = receiverUser;
    }

    public Date getLastMessageTime() {
        return lastMessageTime;
    }

    public void setLastMessageTime(Date lastMessageTime) {
        this.lastMessageTime = lastMessageTime;
    }

    public Integer getCommunicationId() {
        return communicationId;
    }

    public void setCommunicationId(Integer communicationId) {
        this.communicationId = communicationId;
    }
    public Integer getSender() {
        return sender;
    }

    public void setSender(Integer sender) {
        this.sender = sender;
    }

    public Integer getReceiver() {
        return receiver;
    }

    public void setReceiver(Integer receiver) {
        this.receiver = receiver;
    }

    public boolean isHasNewMessage() {
        return hasNewMessage;
    }

    public void setHasNewMessage(boolean hasNewMessage) {
        this.hasNewMessage = hasNewMessage;
    }

    @Override
    public String toString() {
        return "Communication{" +
                "sender='" + sender + '\'' +
                ", receiver='" + receiver + '\'' +
                ", hasNewMessage=" + hasNewMessage +
                '}';
    }
}
